package com.cskaoyan.wordmemorize.controller.app;

import com.cskaoyan.wordmemorize.auth.StpKit;
import com.cskaoyan.wordmemorize.common.result.Result;
import com.cskaoyan.wordmemorize.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/user/day")
public class DailyVocabularyCountController {

    @Autowired
    UserService userService;

    @PutMapping("/voc")
    public Result updateVocCountOfDay(@RequestParam("count") Integer count) {
        Long userId = StpKit.USER.getLoginIdAsLong();
        userService.updateVocCountOfDay(userId,count);
        return Result.ok();
    }
}
